package com.powerbank.common.event;

import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 交易完成事件
 */
@Data
public class TransactionCompletedEvent {

    /**
     * 交易号
     */
    private String transactionNo;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 交易金额
     */
    private BigDecimal amount;

    /**
     * 交易类型：RECHARGE-充值，CONSUME-消费，REFUND-退款
     */
    private String transactionType;

    /**
     * 创建时间
     */
    private LocalDateTime createdTime;

    public TransactionCompletedEvent() {
        this.createdTime = LocalDateTime.now();
    }

    public TransactionCompletedEvent(String transactionNo, Long userId, BigDecimal amount, String transactionType) {
        this.transactionNo = transactionNo;
        this.userId = userId;
        this.amount = amount;
        this.transactionType = transactionType;
        this.createdTime = LocalDateTime.now();
    }
}